package com.jia.controller.api;

import com.jia.common.lang.R;
import com.jia.entity.SysUser;
import com.jia.service.SysUserService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Api(tags = "用户相关")
@RequestMapping("/api/user")
public class ApiSysUserController {

    @Autowired
    private SysUserService sysUserService;

    @PostMapping("/register")
    public R register(@RequestBody SysUser sysUser){
        sysUserService.register(sysUser);
        return R.ok().message("注册成功");
    }

    @PostMapping("/changePassword")
    public R changePassword(@RequestBody SysUser sysUser){
        sysUserService.changePassword(sysUser);
        return R.ok().message("找回成功");
    }
}
